&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Include 
/*------------------------------------------------------------------------
    File        : 
    Purpose     :

    Syntax      :

    Description :

    Author(s)   :
    Created     :
    Notes       :
  ----------------------------------------------------------------------*/
/*          This .W file was created with the Progress AppBuilder.      */
/*----------------------------------------------------------------------*/

/* ***************************  Definitions  ************************** */

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK 

/* ********************  Preprocessor Definitions  ******************** */



/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME



/* *********************** Procedure Settings ************************ */

&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
   Type: Include
   Allow: 
   Frames: 0
   Add Fields to: Neither
   Other Settings: INCLUDE-ONLY
 */
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS

/* *************************  Create Window  ************************** */

&ANALYZE-SUSPEND _CREATE-WINDOW
/* DESIGN Window definition (used by the UIB) 
  CREATE WINDOW Include ASSIGN
         HEIGHT             = 15
         WIDTH              = 60.
/* END WINDOW DEFINITION */
                                                                        */
&ANALYZE-RESUME

 


&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Include 


/* ***************************  Main Block  *************************** */


   DEF BUFFER wk-docld FOR docld.
   DEF BUFFER wk-doce  FOR doce.

   DEF INPUT PARAMETER buf-ref    AS   CHARACTER                   NO-UNDO.
   DEF INPUT PARAMETER buf-qte    AS   INTEGER                     NO-UNDO.
   
   DEF            VAR ind         AS   INTEGER                     NO-UNDO.
   DEF            VAR buf-pumb    LIKE docld.punite                NO-UNDO.
   
   FIND LAST wk-docld WHERE wk-docld.nosoc  = doce.nosoc
                        AND wk-docld.typdoc = doce.typdoc
                        AND wk-docld.prefix = doce.prefix
                        AND wk-docld.nodoc  = doce.nodoc
                        NO-LOCK NO-ERROR.
   
   ind = IF AVAILABLE wk-docld THEN wk-docld.noseq + 1 ELSE 1.

   CREATE docld.
   ASSIGN docld.nosoc  = doce.nosoc
          docld.typdoc = doce.typdoc
          docld.prefix = doce.prefix
          docld.nodoc  = doce.nodoc
          docld.noseq  = ind
          docld.nosui  = ind * 10
          docld.norep  = doce.norep
          docld.csmtr  = doce.csmtr.

   ASSIGN docld.ref    = buf-ref
          docld.qteumq = buf-qte
          docld.qtec   = docld.qteumq
          docld.qteumb = docld.qtec
          docld.solde  = docld.qtec
          docld.nostoc = 1.


   RUN calcul_mtligne.

   RUN facrliba.p.

/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME


